package com.ruoyi.center.demo.mqlistener;

import com.alibaba.fastjson.JSON;
import com.ruoyi.common.rocketmq.dto.MqMsgDto;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(consumerGroup = "${rocketmq.producer.group}",
        topic = "${rocketmq.test.topic}")
@Slf4j
public class RocketmqConsumer implements RocketMQListener<MqMsgDto> {
    @Override
    public void onMessage(MqMsgDto message) {
        log.info("开始消费rocketmq消息：" + JSON.toJSONString(message));
    }
}
